<template>
  <!-- 主业计划物资详情 -->
  <div class="main-material-detail-comp page-container">
    <back-header></back-header>
    <div class="flex-auto overflow-y">
      <div class="page-container-inner full-height full-width no-scroll-x no-scroll-y flex-column">
        <data-detail :dataLoadig="dataLoadig" :detailData="detailData"></data-detail>
      </div>
    </div>
  </div>
</template>

<script>
import BackHeader from '@/components/business/page-comp/back-header/back-header.vue';
import DataDetail from '@/components/business/page-comp/data-detail/data-detail.vue';
import api from '../api/index.js';
export default {
  name: 'MainMaterialDetail',
  components: { BackHeader, DataDetail },
  props: {
    subTaskId: {
      type: String,
      default() {
        return ''
      },
    },
  },
  data() {
    return {
      dataLoadig: true,
      detailData: {},
    };
  },
  computed: {},
  beforeDestroy() { },
  created() {
    this.getDetail();
  },
  methods: {
    getDetail() {
      this.dataLoadig = true;
      api.getSubTask({
        subTaskId: this.subTaskId
      })
        .then((res) => {
          this.dataLoadig = false;
          if (res.success) {
            this.$log.debug('查询主业计划子任务详情成功');
            this.buildDetail(res.data);
          } else {
            this.$log.error('查询主业计划子任务详情失败，错误信息为：', res.message);
            this.$message.error('查询主业计划子任务详情失败：' + (res.message || ''));
          }
        })
        .catch((e) => {
          this.dataLoadig = false;
          this.$log.error('查询主业计划子任务详情失败，错误信息为：', e);
        });
    },
    buildDetail(data = {}) {
      const warnFields = (data.warnFields || '').split(',').map(item => {
        return (item ||'').trim();
      });
      this.detailData = {
        explains: (data.resultRemark || '').split(';').filter(item => {
          return item && item.length;
        }),
        data: [
          { label: '项目名称', span: 5, value: data.projectName || '', warning: warnFields.indexOf('projectName') !== -1 },
          { label: '计划批次名称', span: 5, value: data.planNumberName || '', warning: warnFields.indexOf('planNumberName') !== -1 },

          { label: '物质唯一编码（批次编码）', value: data.sku || '', warning: warnFields.indexOf('sku') !== -1 },
          { label: '需求数量', value: data.demandQuantity || '', warning: warnFields.indexOf('demandQuantity') !== -1 },
          { label: '物料描述', value: data.materialDesc || '', warning: warnFields.indexOf('materialDesc') !== -1 },

          { label: '需求物料编码', value: data.materialCode || '', warning: warnFields.indexOf('materialCode') !== -1 },
          { label: '工程名称', value: data.engineeringName || '', warning: warnFields.indexOf('engineeringName') !== -1 },
          { label: '物料扩展描述', value: data.materialExtendDesc || '', warning: warnFields.indexOf('materialExtendDesc') !== -1 },

          { label: '物料扩展编码', value: data.materialExtendCode || '', warning: warnFields.indexOf('materialExtendCode') !== -1 },
          { label: '标准物料', value: data.standardmaterials || '', warning: warnFields.indexOf('standardmaterials') !== -1 },
          { label: '大类描述', value: data.divisionDesc || '', warning: warnFields.indexOf('divisionDesc') !== -1 },

          { label: '项目编码', value: data.projectCode || '', warning: warnFields.indexOf('projectCode') !== -1 },
          { label: '概算单价(元)', value: data.estimatePrice || '', warning: warnFields.indexOf('estimatePrice') !== -1 },
          { label: '中类描述', value: data.groupDesc || '', warning: warnFields.indexOf('groupDesc') !== -1 },

          { label: '工程编号', value: data.engineeringCode || '', warning: warnFields.indexOf('engineeringCode') !== -1 },
          { label: '交货方式', value: data.deliveryMethod || '', warning: warnFields.indexOf('deliveryMethod') !== -1 },
          { label: '小类描述', value: data.classDesc || '', warning: warnFields.indexOf('classDesc') !== -1 },

          { label: '电子商务平台技术规范书ID', value: data.technicalspecificationsId || '', warning: warnFields.indexOf('technicalspecificationsId') !== -1 },
          { label: '单位', value: data.unit || '', warning: warnFields.indexOf('unit') !== -1 },
          { label: '首批交货日期', value: data.firstdeliveryDate || '', warning: warnFields.indexOf('firstdeliveryDate') !== -1 },
          
          { label: '计划编号', value: data.planCode || '', warning: warnFields.indexOf('planCode') !== -1 },
          { label: '工程电压等级', value: data.voltageClass || '', warning: warnFields.indexOf('voltageClass') !== -1 },
          { label: '最后一批交货日期', value: data.lastdeliveryDate || '', warning: warnFields.indexOf('lastdeliveryDate') !== -1 },

          { label: '行项目号', value: data.projectNumber || '', warning: warnFields.indexOf('projectNumber') !== -1 },
          { label: '编制人中文', value: data.preparedby || '', warning: warnFields.indexOf('preparedby') !== -1 },
          { label: '交货地点', value: data.deliveryAddress || '', warning: warnFields.indexOf('deliveryAddress') !== -1 },

          { label: '概算总价(元)', value: data.estimatetotal || '', warning: warnFields.indexOf('estimatetotal') !== -1 },
          { label: '需求归口管理部门', value: data.manageDepartment || '', warning: warnFields.indexOf('manageDepartment') !== -1 },
          { label: '批次采购方式', value: data.procurementMethod || '', warning: warnFields.indexOf('procurementMethod') !== -1 },

          { label: '前期厂家', value: data.previousFactory || '', warning: warnFields.indexOf('previousFactory') !== -1 },
          { label: '设计单位', value: data.designUnit || '', warning: warnFields.indexOf('designUnit') !== -1 },
          { label: '需求计划备注', value: data.planRemark || '', warning: warnFields.indexOf('planRemark') !== -1 },

          { label: '计划批次', value: data.planNumber || '', warning: warnFields.indexOf('planNumber') !== -1 },
          { label: '特殊采购方式', value: data.specialpurchaseMethod || '', warning: warnFields.indexOf('specialpurchaseMethod') !== -1 },
          { label: '产权属性', value: data.propertyrights || '', warning: warnFields.indexOf('propertyrights') !== -1 },

          { label: '配套金具', value: data.armourclamp || '', warning: warnFields.indexOf('armourclamp') !== -1 },
          { label: '项目类别', value: data.projectClass || '', warning: warnFields.indexOf('projectClass') !== -1 },
          { label: '产权属性描述', value: data.propertyrightsDesc || '', warning: warnFields.indexOf('propertyrightsDesc') !== -1 },

          { label: '建设性质', value: data.ageneralconditons || '', warning: warnFields.indexOf('ageneralconditons') !== -1 },
          { label: '工程性质', value: data.engineeringproperties || '', warning: warnFields.indexOf('engineeringproperties') !== -1 },
          { label: '资金属性', value: data.propertyfund || '', warning: warnFields.indexOf('propertyfund') !== -1 },

          { label: '市级属地', value: data.city || '', warning: warnFields.indexOf('city') !== -1 },
          { label: '计划类型', value: data.planType || '', warning: warnFields.indexOf('planType') !== -1 },
          { label: '资金属性描述', value: data.propertyfundDesc || '', warning: warnFields.indexOf('propertyfundDesc') !== -1 },

          { label: '项目列帐单位编码', value: data.projectUnitCode || '', warning: warnFields.indexOf('projectUnitCode') !== -1 },
          { label: '计划提交日期', value: data.planSubmitDate || '', warning: warnFields.indexOf('planSubmitDate') !== -1 },
          { label: '项目二级分类', value: data.projectSecClass || '', warning: warnFields.indexOf('projectSecClass') !== -1 },
          
          { label: '物料组', value: data.materialGroup || '', warning: warnFields.indexOf('materialGroup') !== -1 },
          { label: '三级分类', value: data.threeClass || '', warning: warnFields.indexOf('threeClass') !== -1 },
          { label: '项目二级分类描述', value: data.projetSecClassdesc || '', warning: warnFields.indexOf('projetSecClassdesc') !== -1 },
          
          { label: '技术规范书编号', value: data.technicalspecificationsCode || '', warning: warnFields.indexOf('technicalspecificationsCode') !== -1 },
          { label: '项目类型', value: data.projectType || '', warning: warnFields.indexOf('projectType') !== -1 },
          { label: '项目类型描述', value: data.projectClassdesc || '', warning: warnFields.indexOf('projectClassdesc') !== -1 },

          { label: '技术规范书ID验证状态', value: data.technicalspecificationsStatus || '', warning: warnFields.indexOf('technicalspecificationsStatus') !== -1 },
          { label: '计划编制日期', value: data.planestablishmentDate || '', warning: warnFields.indexOf('planestablishmentDate') !== -1 },
          { label: '项目列帐单位描述', value: data.projectUnitDesc || '', warning: warnFields.indexOf('projectUnitDesc') !== -1 },

          { label: '国网退回时间', value: data.stategridreturnDate || '', warning: warnFields.indexOf('stategridreturnDate') !== -1 },
          { label: '省公司退回时间', value: data.provincereturnDate || '', warning: warnFields.indexOf('provincereturnDate') !== -1 },
          { label: '市公司退回时间', value: data.cityreturnDate || '', warning: warnFields.indexOf('cityreturnDate') !== -1 },

          { label: '省公司批准时间', value: data.provinceapproveDate || '', warning: warnFields.indexOf('provinceapproveDate') !== -1 },
          { label: '市公司批准时间', value: data.cityapproveDate || '', warning: warnFields.indexOf('cityapproveDate') !== -1 },
          { label: '招标模式描述', value: data.biddingModeDesc || '', warning: warnFields.indexOf('biddingModeDesc') !== -1 },

          { label: '采购方式差异备注序号', value: data.remarkSequence || '', warning: warnFields.indexOf('remarkSequence') !== -1 },
          { label: '审批状态', value: data.approveStatus || '', warning: warnFields.indexOf('approveStatus') !== -1 },
          { label: '计划类型描述', value: data.planTypeDesc || '', warning: warnFields.indexOf('planTypeDesc') !== -1 },

          { label: '供货周期(计划管理平台)', value: data.supplyCycle || '', warning: warnFields.indexOf('supplyCycle') !== -1 },
          { label: '联系电话', value: data.telphone || '', warning: warnFields.indexOf('telphone') !== -1 },
          { label: '三级分类描述', value: data.threeClassDesc || '', warning: warnFields.indexOf('threeClassDesc') !== -1 },
          
          { label: '目录建议采购方式', value: data.adviceProcurementMethod || '', warning: warnFields.indexOf('adviceProcurementMethod') !== -1 },
          { label: '总部批次未使用总部固化ID详细说明', value: data.detailRemark || '', warning: warnFields.indexOf('detailRemark') !== -1 },
          { label: '采购方式差异备注说明', value: data.remarkDesc || '', warning: warnFields.indexOf('remarkDesc') !== -1 },
          
          { label: '总部批次未使用总部固化ID原因分类', value: data.remarkClass || '', warning: warnFields.indexOf('remarkClass') !== -1 },
        ]
      };
    },
  }
};
</script>

<style lang="scss" scoped>
.main-material-detail-comp {}
</style>
